package com.wfu.module_local_video.adapter;

import android.support.annotation.Nullable;
import android.text.format.Formatter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.wfu.module_base.utils.AbDateUtil;
import com.wfu.module_local_video.R;
import com.wfu.module_local_video.adapter.viewholder.MobileViewHolder;
import com.wfu.module_local_video.bean.MediaItem;

import java.util.List;

/**
 * Describe:
 * Author: wfy
 * Version:
 * Create by (wfy) on 2018/5/9 0:15
 * <p>
 * company :
 */
public class LocalVideoAdapter extends BaseQuickAdapter<MediaItem, MobileViewHolder> {

    public LocalVideoAdapter(int layoutResId, @Nullable List<MediaItem> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(MobileViewHolder helper, MediaItem item) {
        helper.setImageFile(R.id.iv_video_icon, item.data)
                .setText(R.id.tv_video_title, item.name)
                .setText(R.id.tv_duration, AbDateUtil.getStringByFormat(item.duration, AbDateUtil.dateFormatMS))
                .setText(R.id.tv_size, Formatter.formatFileSize(mContext, item.size));

    }
}
